local lock_key = 'L_'..tostring(KEYS[1]);
local queue = 'Q_'..tostring(KEYS[1]);
local lock = redis.call('setnx',lock_key,1);
if(lock == 0)
then
    return -1;
end
for i=100001,999999 do
    if(redis.call('hexists',KEYS[1],i) == 0)
    then
        redis.call('sadd',queue,i);
    end
end
redis.call('del',lock_key);
return KEYS[1];